/*
 *  (c) E.S.A.
 */
#include "tokenizer.h"

/*
 * Function for initialising the string buffer
 */
void String_Tokenizer::set_string( string str_buff, string str_delim ) 
{
	buffer = str_buff; 
	delim = str_delim;
	first_pos = buffer.find_first_not_of(delim);
	last_pos = buffer.find_first_of(delim, first_pos);
	
	this_token = "";
}


string String_Tokenizer::next_token() 
{
	this_token.clear();
	this_token.append(buffer.substr(first_pos, last_pos - first_pos));
	
	first_pos = buffer.find_first_not_of(delim, last_pos);
	last_pos = buffer.find_first_of(delim, first_pos);
	
	return this_token;
}


bool String_Tokenizer::has_more_tokens() 
{
	bool more_tokens = first_pos != string::npos;
	
	return more_tokens;
}



